<?php

namespace App\Http\Controllers\Pc;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\QianyiModel;
use Illuminate\Support\Facades\DB;

class QianyiController extends Controller
{
    private $model;
    private $request;

    public function __construct(Request $request)
    {
        $this->model = new QianyiModel();
        $this->request = $request;
    }

    /**
     * 测试
     */
    public function Test()
    {

        $params = $this->request->all();

        $result = $this->model->TestM($params);

        return $this->Ts_back($result);
    }

       /**
     * 新增产品
     */
    public function AddSku()
    {

        $params = $this->request->all();

        $result = $this->model->AddSkuM($params);

        return $this->Ts_back($result);
    } 

    
       /**
     * 查询采购单
     */
    public function PurchaseOrderList()
    {

        $params = $this->request->all();

        $result = $this->model->PurchaseOrderListM($params);

        return $this->Ts_back($result);
    } 

           /**
     * 查询采购单
     */
    public function PurchaseOrderListTotal()
    {

        $params = $this->request->all();

        $result = $this->model->PurchaseOrderListTotalM($params);

        return $this->Ts_back($result);
    } 

           /**
     * 查询采购单
     */
    public function UpPurchaseOrder()
    {

        $params = $this->request->all();

        $result = $this->model->UpPurchaseOrderM($params);

        return $this->Ts_back($result);
    } 

    
    
        
       /**
     * 查询采购单
     */
    public function PurchaseOrder()
    {

        $params = $this->request->all();

        $result = $this->model->PurchaseOrderM($params);

        return $this->Ts_back($result);
    } 
    
   
    public function Ts_back($params){

        if($params['type']=='success'){
            return $this->back('获取成功', '200', $params['data']);
        }else{
            return $this->back($params['msg'], '300');
        }
    }


}